<?
include "server_config.php";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> 넥도닥 [NextDoorDoctor] :: 멘토-멘티 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="css/common.css">
	<script type="text/javascript" src="./js/jquery-1.6.2.min.js"></script>
	<script>
		var current_menu = 2;
		<? include 'js/common.js';?>
	</script>
 </head>

 <body >
  <table border=0 width='980px' align='center'>
	

<?
include "nddg_top_menu.php";
?>	

	<tr>
		<td>
			<div style='width:700px;padding:25px;border:1px solid #D6D6D6; float:left;'>
				<? 
				if($user_idx=="")
				{
					?>
				<textarea name='new_talk' style='width:600px;height:100px;' disabled>로그인이 필요합니다.</textarea>
				<div style='float:right;width:80px;height:20px;padding-top:80px;'>
					<input type='button' value='글 올리기' disabled>
				</div>
				<?
				}
				else
				{
					?>
					<form id='fwrite'>
						<textarea name='new_talk' id="new_talk" style='width:600px;height:100px;'></textarea>
						<div style='float:right;width:80px;height:20px;padding-top:80px;'>
							<input type='button' value='글 올리기' onclick='talk_register();'>
						</div>
					</form>
				<?
				}
					?>
				<br>
				<br>
				<div style='width:700px;float:left' id='talk_list'></div>
				
			</div>




			
		</td>
	</tr>

<?
include "nddg_footer.php";
?>	

  </table>
 </body>
</html>

<script>
	function talk_display_list(page)
	{
		$('#img_show_more').attr("src", "./img/loading.gif");

//		alert(documnet_idx);

		$('#talk_list').load('nddg_talk_list.php', {'page' : page});

	}	

	$(document).ready(function(){ 
		talk_display_list(1); 

	});
	
	function talk_register()
	{
		var string = $("#fwrite").serialize(); 
				
		$.ajax(
		{
			type: "POST",
			url: "nddg_talk_new.php",
			data: string,
			
			success: function(msg) {
				if(msg==1)
				{
					talk_display_list(1);
					$('#new_talk').val("");
					
				}
				else
				{
					alert(msg);
				}
			}
			
		})		

	}
</script>